//
//  AppDelegate.m
//  01-UIViewHomeWork
//
//  Created by QC.L on 16/7/14.
//  Copyright © 2016年 QC.L. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"
#define WIDTH _window.frame.size.width
#define HEIGHT _window.frame.size.height
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    _window.backgroundColor = [UIColor blackColor];
    [_window makeKeyAndVisible];
    _window.rootViewController = [[ViewController alloc] init];
    /**
    UIImageView *bgView = [[UIImageView alloc]initWithFrame:_window.frame];
    [bgView setImage:[UIImage imageNamed:@"welcome_2"]];
    [_window addSubview:bgView];
    [bgView setUserInteractionEnabled:YES];
    //
    NSLog(@"%f,%f",_window.frame.size.width,_window.frame.size.height);
    
   
    UIImage *lgImage = [UIImage imageNamed:@"logo_lagou"];
     UIView *lgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, lgImage.size.width, lgImage.size.height)];
    lgView.center = CGPointMake(WIDTH / 2, HEIGHT / 4 + 25);
    UIColor *lgColor = [UIColor colorWithPatternImage:lgImage];
    [lgView setBackgroundColor:lgColor];
    [bgView addSubview:lgView];
    
    UITextField *myselfTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, WIDTH - 20, 50)];
    myselfTextField.borderStyle = UITextBorderStyleRoundedRect;
    myselfTextField.center = CGPointMake(WIDTH / 2, HEIGHT / 2);
    myselfTextField.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];

    [bgView addSubview:myselfTextField];
    UIView *myselfView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
    myselfView.backgroundColor = [UIColor blackColor];

    UIImageView *myselfImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    myselfImageView.center = CGPointMake(myselfView.center.x, myselfView.center.y);
    [myselfImageView setImage:[UIImage imageNamed:@"icon_username"]];
    [myselfView addSubview:myselfImageView];
    myselfTextField.leftView = myselfView;
    myselfTextField.leftViewMode = UITextFieldViewModeAlways;
    
    UITextField *lockTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, WIDTH - 20, 50)];
    lockTextField.borderStyle = UITextBorderStyleRoundedRect;
    lockTextField.center = CGPointMake(WIDTH / 2, HEIGHT / 2 + 50);
    lockTextField.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.4];
    
    [bgView addSubview:lockTextField];
    UIView *lockView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
    lockView.backgroundColor = [UIColor blackColor];
    
    UIImageView *lockImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 35, 35)];
    lockImageView.center = CGPointMake(lockView.center.x, lockView.center.y);
    [lockImageView setImage:[UIImage imageNamed:@"icon_password"]];
    [lockView addSubview:lockImageView];
    lockTextField.leftView = lockView;


    lockTextField.leftViewMode = UITextFieldViewModeAlways;
    
    //
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH - 20, 3)];
    lineView.center = CGPointMake(WIDTH / 2, HEIGHT / 2 + 25);
    lineView.backgroundColor = [UIColor colorWithRed:101 / 255.0 green:95 / 255.0 blue:91 / 255.0 alpha:100];
    [bgView addSubview:lineView];
    
    UIButton *loadButton = [UIButton buttonWithType:UIButtonTypeCustom];
    loadButton.frame = CGRectMake(0, 0, WIDTH - 20 , 50);
    loadButton.center = CGPointMake(WIDTH / 2, HEIGHT / 2 + 130);
    loadButton.layer.cornerRadius = 5;
    // 22 18 15
    // 49 40 32
    // 57 160 115
    // 0 174 136
    // 101 95 91
    UIColor *bluColor = [UIColor colorWithRed:0  green:160 / 255.0 blue:136 / 255.0 alpha:100];
    loadButton.backgroundColor = [UIColor colorWithRed:0  green:174 / 255.0 blue:136 / 255.0 alpha:100];
    [bgView addSubview:loadButton];
    [loadButton setTitle:@"登录" forState:0];
    [loadButton setTitleColor:[UIColor colorWithRed:0  green:160 / 255.0 blue:136 / 255.0 alpha:100] forState:0];
    loadButton.titleLabel.font = [UIFont boldSystemFontOfSize:18];


    UIButton *secureButton = [UIButton buttonWithType:UIButtonTypeSystem];
    secureButton.frame = CGRectMake(0, 0, 80, 30);
    [secureButton setTitle:@"忘记密码" forState:0];
    [bgView addSubview:secureButton];
    secureButton.center = CGPointMake(WIDTH / 8, HEIGHT / 2 + 200);
    [secureButton setTintColor:[UIColor whiteColor]];
    secureButton.titleLabel.font = [UIFont boldSystemFontOfSize:18];
    secureButton.backgroundColor = [UIColor clearColor];

//
    UIButton *lagouButton = [UIButton buttonWithType:UIButtonTypeSystem];
    lagouButton.frame = CGRectMake(0, 0,120,40);
    lagouButton.center = CGPointMake(WIDTH / 2, HEIGHT / 2 + 250);
    [lagouButton setTitle:@"现在注册拉勾" forState:0];
    
    [lagouButton setTitleColor:bluColor forState:0];
    lagouButton.titleLabel.font = [UIFont boldSystemFontOfSize:19];
    [bgView addSubview:lagouButton];
    //
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, (WIDTH - 20 - 60) / 2, 2)];
    line1.center = CGPointMake(WIDTH / 4, HEIGHT / 2 + 295);
    line1.backgroundColor = [UIColor whiteColor];
    [bgView addSubview:line1];
    UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, (WIDTH - 20 - 60) / 2, 2)];
    line2.center = CGPointMake(WIDTH / 4 * 3, HEIGHT / 2 + 295);
    line2.backgroundColor = [UIColor whiteColor];
    [bgView addSubview:line2];
    //
    UILabel *orLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 30)];
    orLabel.center = CGPointMake(WIDTH / 2, HEIGHT / 2 + 295);
    orLabel.text = @"or";
    orLabel.textColor = [UIColor whiteColor];
    orLabel.textAlignment = 1;
    orLabel.font = [UIFont boldSystemFontOfSize:20];
    orLabel.backgroundColor = [UIColor clearColor];
    [bgView addSubview:orLabel];
    //
    UIButton *lookButton = [UIButton buttonWithType:UIButtonTypeSystem];
    lookButton.frame = CGRectMake(0, 0, 90, 30);
    lookButton.center = CGPointMake(WIDTH / 2, HEIGHT / 2 + 295 + 30);
    [bgView addSubview:lookButton];
    [lookButton setTitle:@"随便逛逛>" forState:0];
    [lookButton setTitleColor:[UIColor whiteColor] forState:0];
    lookButton.titleLabel.font = [UIFont boldSystemFontOfSize:18];
    [lookButton addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];*/
    return YES;
}
- (void)click{
    NSLog(@"adad");
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
